package club.tclyq.good_time.document.controller;

import club.tclyq.good_time.document.service.ExportDocumentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.FileNotFoundException;

/**
 * @author tanchong
 * Create Date: 2019/2/26
 */
@RestController
@RequestMapping("/document")
public class DocumentController {

    private ExportDocumentService exportDocumentService;

    @Autowired
    public DocumentController(ExportDocumentService exportDocumentService) {
        this.exportDocumentService = exportDocumentService;
    }

    @GetMapping
    public void exportDocument(String flag, HttpServletRequest request, HttpServletResponse response) throws FileNotFoundException {
        exportDocumentService.exportHelpDocument(response,request,flag);
    }
}
